<?php
class Language_Controller extends Template_Controller {

	public $template = 'client/index';
	
    public function __construct()
    {
        parent::__construct();
    }
    
    public function index($page,$lang)
    {	
    	$model = new Language_Model();
		$this->db->where('languages_code',$lang);
		$list = $model->get_with_active();
		if($page == 'client')
		{	
			$this->session->set('sess_client_lang',$list[0]['languages_id']);
			$this->session->set('sess_client_lang_code',$list[0]['languages_code']);
			//url::redirect('home');			
		}		
		if($page == 'admin')
		{
			$this->session->set('sess_admin_lang',$list[0]['languages_id']);
			$this->session->set('sess_admin_lang_code',$list[0]['languages_code']);
			//url::redirect('admin');
		}
		url::redirect($this->site['history']['back']);
		//url::redirect('news');
    }
}
?>